package com.beiding.hotcode.v2;

import java.lang.reflect.Method;

class MethodHolder {

    private Method method;
    private Class[] paramTypes;

    MethodHolder(Method method, Class[] paramTypes) {
        this.method = method;
        this.paramTypes = paramTypes;
    }

    Method getMethod() {
        return method;
    }

    boolean match(Object... ps) {

        for (int i = 0; i < paramTypes.length; i++) {
            if (ps[i] == null) {
                continue;
            }

            if (!paramTypes[i].isInstance(ps[i])) {
                return false;
            }

        }

        return true;
    }



    Class[] getParamTypes() {
        return paramTypes;
    }
}
